<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/session.php";
	require "includes/sql_functions.php";
	require "includes/slot_functions.php";
	require "includes/game_functions.php";
	require "includes/signup_functions.php";
	
	if(oh_is_logged_in()) // otherwise, we don't belong here
	{
		render_header("Schedule");
	
		$slots=oh_get_all_slots();
		
		if($_GET['user'])	// attempting to view someone else's. Better be an admin
		{
			oh_require_admin();
			$user_id=$_GET['user'];
		}
		else				// viewing our own.
		{
			$user_id=$_SESSION['user_id'];
		}
		
		echo "<table>\n";
		foreach($slots as $slot)
		{	
			echo "<tr>\n";
			echo "<td class=\"regtablehead\">\n";
			oh_slot_print($slot);
			echo "</td>\n";
			oh_render_user_records_for_slot($slot->slot_id,$user_id);
			echo "</tr>\n";
		}
		echo "</table>";
	}
	render_footer();
?>